home *** CD-ROM | disk | FTP | other *** search
/ SCI Games E3 2005 Press Kit (USA) / SCI Games E3 2005 Press Kit (USA).bin / runme_mac.swf / scripts / frame_22 / DoAction.as
Text File  |  2005-05-05  |  5KB  |  154 lines

  1. function LoadXml()
  2. {
  3.    gamesXML = new XML();
  4.    gamesXML.ignoreWhite = true;
  5.    gamesXML.load("data/content/games.xml");
  6.    gamesXML.onLoad = CheckData;
  7. }
  8. function CheckData(success)
  9. {
  10.    if(success)
  11.    {
  12.       chkData = "Load successful";
  13.       CM_dataxml();
  14.    }
  15.    else
  16.    {
  17.       chkData = "error";
  18.       stop();
  19.    }
  20. }
  21. function CM_dataxml()
  22. {
  23.    var _loc19_ = 0;
  24.    var _loc18_ = gamesXML.firstChild;
  25.    totalGames = _loc18_.childNodes;
  26.    trace(totalGames.length);
  27.    x = 0;
  28.    while(x < totalGames.length)
  29.    {
  30.       GameContent = totalGames[x].childNodes;
  31.       ii = 0;
  32.       while(ii < GameContent.length)
  33.       {
  34.          if(GameContent[ii].nodeName.toLowerCase() == "title")
  35.          {
  36.             var _loc14_ = "" + GameContent[ii].firstChild.nodeValue + "";
  37.          }
  38.          if(GameContent[ii].nodeName.toLowerCase() == "title_icon")
  39.          {
  40.             var _loc15_ = "" + GameContent[ii].firstChild.nodeValue + "";
  41.          }
  42.          if(GameContent[ii].nodeName.toLowerCase() == "story")
  43.          {
  44.             var _loc16_ = "" + GameContent[ii].firstChild.nodeValue + "";
  45.          }
  46.          if(GameContent[ii].nodeName.toLowerCase() == "title_banner")
  47.          {
  48.             var _loc17_ = "" + GameContent[ii].firstChild.nodeValue + "";
  49.          }
  50.          if(GameContent[ii].nodeName.toLowerCase() == "features")
  51.          {
  52.             var _loc1_ = 0;
  53.             var _loc5_ = new Array();
  54.             var _loc11_ = new Array();
  55.             _loc5_ = GameContent[ii].childNodes;
  56.             while(_loc1_ <= _loc5_.length)
  57.             {
  58.                if(_loc5_[_loc1_].nodeName.toLowerCase() == "feat_id")
  59.                {
  60.                   _loc11_[_loc1_] = "" + _loc5_[_loc1_].firstChild.nodeValue + "";
  61.                }
  62.                _loc1_ = _loc1_ + 1;
  63.             }
  64.          }
  65.          if(GameContent[ii].nodeName.toLowerCase() == "media")
  66.          {
  67.             var _loc2_ = 0;
  68.             var _loc3_ = new Array();
  69.             _loc3_ = GameContent[ii].childNodes;
  70.             while(_loc2_ <= _loc3_.length)
  71.             {
  72.                if(_loc3_[_loc2_].nodeName.toLowerCase() == "screens")
  73.                {
  74.                   _loc1_ = 0;
  75.                   var _loc4_ = new Array();
  76.                   var _loc8_ = new Array();
  77.                   _loc4_ = _loc3_[_loc2_].childNodes;
  78.                   while(_loc1_ <= _loc4_.length)
  79.                   {
  80.                      if(_loc4_[_loc1_].nodeName.toLowerCase() == "screen_id")
  81.                      {
  82.                         _loc8_[_loc1_] = "" + _loc4_[_loc1_].firstChild.nodeValue + "";
  83.                      }
  84.                      _loc1_ = _loc1_ + 1;
  85.                   }
  86.                }
  87.                if(_loc3_[_loc2_].nodeName.toLowerCase() == "video")
  88.                {
  89.                   var _loc13_ = "" + _loc3_[_loc2_].firstChild.nodeValue + "";
  90.                }
  91.                if(_loc3_[_loc2_].nodeName.toLowerCase() == "packshot")
  92.                {
  93.                   var _loc12_ = "" + _loc3_[_loc2_].firstChild.nodeValue + "";
  94.                }
  95.                _loc2_ = _loc2_ + 1;
  96.             }
  97.          }
  98.          if(GameContent[ii].nodeName.toLowerCase() == "quotes")
  99.          {
  100.             _loc1_ = 0;
  101.             var _loc6_ = new Array();
  102.             var _loc9_ = new Array();
  103.             _loc6_ = GameContent[ii].childNodes;
  104.             while(_loc1_ <= _loc6_.length)
  105.             {
  106.                if(_loc6_[_loc1_].nodeName.toLowerCase() == "quote")
  107.                {
  108.                   _loc9_[_loc1_] = "" + _loc6_[_loc1_].firstChild.nodeValue + "";
  109.                }
  110.                _loc1_ = _loc1_ + 1;
  111.             }
  112.          }
  113.          if(GameContent[ii].nodeName.toLowerCase() == "requirements")
  114.          {
  115.             _loc1_ = 0;
  116.             var _loc7_ = new Array();
  117.             var _loc10_ = new Array();
  118.             _loc7_ = GameContent[ii].childNodes;
  119.             while(_loc1_ <= _loc7_.length)
  120.             {
  121.                if(_loc7_[_loc1_].nodeName.toLowerCase() == "platform")
  122.                {
  123.                   _loc10_[_loc1_] = "" + _loc7_[_loc1_].attributes.type + "";
  124.                }
  125.                _loc1_ = _loc1_ + 1;
  126.             }
  127.          }
  128.          ii++;
  129.       }
  130.       GamesData[x] = new CMGame(_loc14_,_loc15_,_loc17_,_loc16_,_loc11_,_loc8_,_loc13_,_loc12_,_loc9_,_loc10_);
  131.       x++;
  132.    }
  133.    play();
  134. }
  135. function CMGame(t, ti, tb, s, fe, sc, vid, ps, qu, re)
  136. {
  137.    this.title = t;
  138.    this.titleIcon = ti;
  139.    this.titleBanner = tb;
  140.    this.story = s;
  141.    this.features = fe;
  142.    this.sceenshots = sc;
  143.    this.video = vid;
  144.    this.packshot = ps;
  145.    this.quotes = qu;
  146.    this.requirment = re;
  147. }
  148. chkData = "Loading Data";
  149. GamesData = new Array();
  150. totalGames = new Array();
  151. GameContent = new Array();
  152. LoadXml();
  153. stop();
  154.